﻿<Window x:Class="WpfDemoAutoWire.Views.WindowAutoBind"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfDemoAutoWire.Views"
        xmlns:VM="clr-namespace:WpfDemoAutoWire.ViewModels"
        xmlns:mark="MvvmBindingPack"
        mc:Ignorable="d"
        x:Name="WindowAutoBindView"
        Title="AutoWireVmDataContext AutoWireViewConrols" Height="350" Width="300">

    <mark:BindXAML.ProcessMvvmExtensions>
        <mark:AutoWireVmDataContext/>
        <mark:AutoWireViewConrols/>
    </mark:BindXAML.ProcessMvvmExtensions>

    <Grid>
        <StackPanel>
            <!-- ************************************************************************************  -->

            <!-- x:Name doesn't have a target list; it will be extracted from a View Model -->
            <Label   x:Name="LabelXNameA"  Height="25" VerticalAlignment="Top" Background="LightGray" />
            <Label   x:Name="Label__XName_B_"  Height="25" VerticalAlignment="Top"/>
            <Label   x:Name="LabelXNameC"  Height="25" VerticalAlignment="Top"  Background="LightGray"/>
            <Label   x:Name="LabelXNameD"  Height="25" VerticalAlignment="Top" />

            <!-- x:Name has a target list {'Content','Height'}; targets will be wire to a View Model -->
            <Label   x:Name="LabelX_______NameF"  Height="25" VerticalAlignment="Top"  Background="Lightblue"/>

            <!-- ************************************************************************************  -->

            <!-- Wire the attached property "Grid.Row" in the View Model, label will show the value of the 'Grid.Row' from the View Model -->
            <Label   x:Name="LabelXNameAP"  Content="{Binding ElementName=LabelXNameAP,Path=(Grid.Row)}"
                     Height="25" VerticalAlignment="Top"  />

            <!-- ************************************************************************************  -->

            <!-- [Button.Command] x:Name doesn't have a target list; it will be extracted from a View Model -->
            <Button  x:Name="ButtonXNameA"  Height="20" VerticalAlignment="Top" />
            <Button  x:Name="ButtonXNameB"  Height="20" VerticalAlignment="Top" />

            <!-- [Button.Command] x:Name has a target list {'Content','Height'}; targets will be wire to a View Model -->
            <Button  x:Name="ButtonXNameC"  Height="20" VerticalAlignment="Top" />

            <!-- [Button.Command] by using BindCommand targets will be wire to a View Model -->
            <Button Content="ButtonBindCommand" 
                    Command="{mark:BindCommand ExecuteMethodName=ExecuteButtonBindCommand,CanExecuteBooleanPropertyName=CanExecuteButtonBindCommand}" />
            <!-- ************************************************************************************  -->

            <!-- Check wiring the View Model to the View to LabelXNameA, LabelXNameA.Content, ButtonXNameA -->

            <Label   x:Name="LabelXNameVM2M"  Height="25" VerticalAlignment="Top" Background="LightGreen" />
            <!-- When the button below is pressed  the label above will be filled with test info -->
            <Button  x:Name="ButtonXNameVM2M"  Height="20" VerticalAlignment="Top" />


            <!-- ************************************************************************************  -->

        </StackPanel>

    </Grid>
</Window>
